﻿using System;
using System.Collections.Generic;
using System.Text;
using AspNetCs.IDAL;
using AspNetCs.DALFactory;
using AspNetCs.Common;
using AspNetCs.Model;
using System.Data;
using AspNetCs.Enumerations.SaleNumber_Enum;
namespace AspNetCs.Bll
{
    public class SaleNumber
    {
        private ISaleNumber CreateNum = Conn.CreateSaleNumber();


        #region ISaleNumber 成员

        public int add(AspNetCs.Model.SaleNumber_Model model)
        {

            if (model == null)
            {
                return -1;
            }
            return CreateNum.add(model);

        }

        public AspNetCs.Model.SaleNumber_Model GetModel(System.Data.DataRow dr)
        {
            return CreateNum.GetModel(dr);

        }

        public AspNetCs.Model.SaleNumber_Model GetModel(int id)
        {
            return CreateNum.GetModel(id);
        }

        #endregion

        /// <summary>
        /// 馆号是否推荐
        /// </summary>
        /// <param name="_StateNum"></param>
        /// <returns></returns>
        public string IsCommend(string _StateNum){
            if (StringHelper.isNumber_int(_StateNum) == 1)
            {
                return "推荐";
            }
            else
            {
                return "正常";
            }
        }
        /// <summary>
        /// 检查该类型的馆号是否存在,SaleNumber_Model.SaleType,SaleNumber_Model.Number必须设置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int NumberIsTrue(SaleNumber_Model model)
        {
            if (model == null) return -1;
            return CreateNum.NumberIsTrue(model);
        }
        public DataTable GetDataTable(string filter)
        {
            return CreateNum.GetDataTable(filter);
        }

        /// <summary>
        /// 检查公墓编号是否存在
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public DataTable GetNetMuIdDataTable(string filter)
        {
            return CreateNum.GetNetMuIdDataTable(filter);
        }
    }
}
